package pers.cocoadel.cloud.movie.controller;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class HeaderController
{

    @GetMapping("/header/get")
    public HeaderBean getHeader(HttpServletRequest request)
    {
        String sensitive = request.getHeader("sensitive-header");
        String ignored = request.getHeader("ignored-header");
        String cookie = request.getHeader("Cookie");
        return new HeaderBean(sensitive, ignored, cookie);
    }

    @AllArgsConstructor
    @Data
    private static class HeaderBean
    {
        private String sensitiveHeader;

        private String ignoredHeader;

        private String cookie;
    }
}
